#include <memory>
#include <iostream>

using namespace std;

class MyClass
{
public:
	MyClass() { cout << "default ctor called..." << endl; }
	~MyClass() { cout << "default dector called ..." << endl; }
};

int main()
{
	cout << "Create an allocator to use." << endl;
	allocator<MyClass> alloc;

	cout << "Allocate uninitialized memory block." << endl;
	auto *memory{alloc.allocate(1)};

	cout << "Use placement new operator to construct a MyClass in place." << endl;
	new (memory) MyClass{};

	cout << "Destroy MyClass instance." << endl;
	destroy_at(memory);

	cout << "Deallocate memory block." << endl;
	alloc.deallocate(memory, 1);
	memory = nullptr;
}
